import axios from '../utils'

const api = {
    login: '/overt/check_user_confirm', //登录
    registered: '/overt/registered',   //注册
    judgeTokenURL: '/overt/password-reset', //判断toKen是否
    sendEmailURL: '/overt/sendEmail',  //发送邮箱验证
    modifyPasswordURL: '/overt/modifyPassword', //修复密码
    getIsRegisterAPI: '/overt/getIsRegister', //查看用户是需要注册功能


}
export default api

export function login(parameter) {
    parameter = JSON.parse(parameter)
    // 获取系统时间
    let d = new Date();
    // 获取需要时区
    let utc = (d.getTimezoneOffset() / 60);
    parameter.timezoneOffset = utc >= 0 ? `+${utc}` : utc;
    parameter = JSON.stringify(parameter)
    return axios({
        url: api.login,
        method: 'post',
        data: parameter
    })
}

export function registered(parameter) {
    return axios({
        url: api.registered,
        method: 'post',
        data: parameter
    })
}

export function judgeToken(reset_password_token = "") {
    return axios.get(api.judgeTokenURL, {
        params: {
            reset_password_token
        }
    })
}

export function sendEmai(email = "") {
    return axios.get(api.sendEmailURL, {
        params: {
            email
        }
    })
}

export function modifyPassword(params) {
    return axios.get(api.modifyPasswordURL, {
        params
    })
}

export function getIsRegister() {
    return axios.get(api.getIsRegisterAPI)
}

